package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LhkHotelService;
import com.ruoyi.system.service.ILhkHotelServiceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 酒店提供的服务Controller
 * 
 * @author ruoyi
 * @date 2025-06-06
 */
@RestController
@RequestMapping("/system/f_service")
public class LhkHotelServiceController extends BaseController
{
    @Autowired
    private ILhkHotelServiceService lhkHotelServiceService;

    /**
     * 查询酒店提供的服务列表
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:list')")
    @GetMapping("/list")
    public TableDataInfo list(LhkHotelService lhkHotelService)
    {
        startPage();
        List<LhkHotelService> list = lhkHotelServiceService.selectLhkHotelServiceList(lhkHotelService);
        return getDataTable(list);
    }

    /**
     * 导出酒店提供的服务列表
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:export')")
    @Log(title = "酒店提供的服务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LhkHotelService lhkHotelService)
    {
        List<LhkHotelService> list = lhkHotelServiceService.selectLhkHotelServiceList(lhkHotelService);
        ExcelUtil<LhkHotelService> util = new ExcelUtil<LhkHotelService>(LhkHotelService.class);
        util.exportExcel(response, list, "酒店提供的服务数据");
    }

    /**
     * 获取酒店提供的服务详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:query')")
    @GetMapping(value = "/{serviceId}")
    public AjaxResult getInfo(@PathVariable("serviceId") Long serviceId)
    {
        return success(lhkHotelServiceService.selectLhkHotelServiceByServiceId(serviceId));
    }

    /**
     * 新增酒店提供的服务
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:add')")
    @Log(title = "酒店提供的服务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LhkHotelService lhkHotelService)
    {
        return toAjax(lhkHotelServiceService.insertLhkHotelService(lhkHotelService));
    }

    /**
     * 修改酒店提供的服务
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:edit')")
    @Log(title = "酒店提供的服务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LhkHotelService lhkHotelService)
    {
        return toAjax(lhkHotelServiceService.updateLhkHotelService(lhkHotelService));
    }

    /**
     * 删除酒店提供的服务
     */
//    @PreAuthorize("@ss.hasPermi('system:f_service:remove')")
    @Log(title = "酒店提供的服务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{serviceIds}")
    public AjaxResult remove(@PathVariable Long[] serviceIds)
    {
        return toAjax(lhkHotelServiceService.deleteLhkHotelServiceByServiceIds(serviceIds));
    }
}
